/**
 * 事件记录模型。
 */
const constants = require('../../utils/constants');

module.exports = class UserEvents extends think.Model {
    get tableName() {
        return 'user_events';
    }

    /**
     * 用户登录记录.
     */
    async login(userId) {
        await this.add({
            userId: userId,
            type: constants.EventType.Login
        }, null);
    }

    /**
     *
     */
    async share(userId, data) {
        await this.add({
            userId: userId,
            type: constants.EventType.Share,
            data: data
        });
    }
};
